<?php  

if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class ledger extends CI_Controller {
	function __construct()
	{
		parent::__construct();
		if (!$this->ion_auth->logged_in())
	  	{
			redirect('auth/login');
	  	}		
		$this->load->library('form_validation');
		$this->load->model('accounts/accounts_model');
		$this->load->model('accounts/payment_model');
		//$this->load->model('accounts/payment_model');
		$this->load->model('accounts/party_model');
		$this->load->library('datatables');		
		
	}
		
	function get(){
		
		echo $this->accounts_model->get_all();
	}	
	
	function create_ledger(){
		$this->data['heads']=$this->party_model->get_head();
		if(count($this->data['heads'])==0){
			$this->data['heads'] = array();
		}
		$meta['page_title'] = "Party Accounts";		
		 $this->load->view('common/header',$meta);
		$this->load->view('accounts/ledger/party_ledger',$this->data);
		 $this->load->view('common/footer');

	}
	
	function get_party(){
		$parties = $this->party_model->get_parties($_REQUEST['id_head'])->result_array();
		foreach($parties as $party){
			
			echo $party['id'];
			echo $party['user_name'];
		}
		exit;
		print_r($this->data['parties']);exit;
		$meta['page_title'] ="Parties Accounts Details";
		$this->load->view('accounts/party_accounts/partyaccounts_list',$this->data);

		
	}
	
	
	function uniqueparty(){
	    $this->data['parties'] = $this->party_model->uniqueparty($_REQUEST['id_user'])->result();
		 $this->data['data'] = $this->party_model->getparty_deatils($_REQUEST['id_user']);
		 $this->data['counter'] = $_REQUEST['counter'];
		$this->load->view('accounts/party_accounts/uniqueparty_list',$this->data);
	}
	function print_uniqueparty($id_user){
		$meta['page_title'] = "Party Report";
	    $this->data['parties'] = $this->party_model->uniqueparty($id_user)->result();
		 $this->data['data'] = $this->party_model->getparty_deatils($id_user);
			 $this->load->view('common/print_header',$meta);
		$this->load->view('accounts/party_accounts/print_uniqueparty_list',$this->data);
		 $this->load->view('common/footer');
	}

	
}
?>